<?php
include("core.php");//加载核心插件
$url=$_SERVER['REQUEST_URI'];

$host=$_SERVER["HTTP_USER_DOMAIN"]??$_SERVER['HTTP_HOST'];


if($url=="/dnscheckstate"){echo $host;return;}//直接检测判断一下域名是否绑定成功
// print_r($_SERVER['REQUEST_METHOD']);




if(!file_exists(__ROOT__.'install.lock') ||file_get_contents(__ROOT__.'install.lock')==$host){
    $host="version";
}
//if(substr($url,0,5)=="/core")$host="version";
if(!file_exists(__ROOT__.'plugin'."/".$host.".php")){echo "[".$host."]当前域名相关插件不存在";return;}
try{
    //include "plugin/".$host.".php" ;//加载插件
    $app=tool::load_plugin(__ROOT__."plugin/".$host.".php");
    if($app===false){echo "驱动程序不正确";return;}
    //$imclass=tool::get_last_class(true);
    
    //if(!class_exists($imclass)){echo "驱动程序不正确";return;}
    
    //$app=new $imclass();
    //$app->filename=$host;
    $app->build();
    App_run($app);
}catch(Exception $e){
    $data="【插件】".$host."<a style='color:red'>错误</a><br/>";
    $data.="报错内容如下:<br/>".$e->getMessage();
}
?>